<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/entity/AccountingEntry.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Command to create a AccountingEntry
	*/
	class CommandCreateAccountingEntry extends CustomCommand {
		/*
		* Constructor of the class
		*/
		public function __construct($date) {
			$this ->accountingEntry = new AccountingEntry($date);
		}
		
		/*
		* Method to execute to create a AccountEntry
		*/
		public function execute() {
			$GLOBALS['debug']->log("entro al comando accountEntry");	
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$ibdad = $daoFactory -> getMySqlAccountAccessDao();
			$accountingEntryCreation = $ibdad -> createAccountingEntry($this ->accountingEntry);
			
			$this -> result = $accountingEntryCreation;
			$GLOBALS['debug']->log("fin del comando accountingEntry");	
		}
	}
?>